package com.netease.plugin_package;

import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;

import com.netease.stander.ActivityInterface;

/**
 * 创建日期：2021/9/28 9:18
 *
 * @author tony.sun
 * 类说明：
 */

public class BaseActivity extends Activity implements ActivityInterface {
    public Activity appActivity;

    @SuppressLint("MissingSuperCall")
    @Override
    public void onCreate(Bundle savedInstanceState) {

    }

    @SuppressLint("MissingSuperCall")
    @Override
    public void onStart() {

    }

    @SuppressLint("MissingSuperCall")
    @Override
    public void onResume() {

    }

    @SuppressLint("MissingSuperCall")
    @Override
    public void onDestroy() {

    }

    /**
     * 获取对应的上下文，这里是proxyActivity
     * @param appActivity
     */
    @Override
    public void insertAppContext(Activity appActivity) {
        this.appActivity=appActivity;
    }

    /**
     * 找id
     * @param id
     * @return
     */
    public View findViewById(int id){
        return appActivity.findViewById(id);
    }

    /**
     * 跳转
     * @param intent
     */
    public void startActivity(Intent intent){
        Intent intentNew = new Intent();
        intentNew.putExtra("className",intent.getComponent().getClassName());//根据包名跳转
        appActivity.startActivity(intentNew);//这里是调用ProxyActivity里的startActivity
    }

    /**
     * 设置布局resId
     * @param resId
     */
    public void setContentView(int resId) {
        appActivity.setContentView(resId);//这里是调用ProxyActivity里的setContentView
    }
}
